package com.wlzg.collectiontool.adapter

import android.widget.CheckBox
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.wlzg.collectiontool.R
import com.wlzg.collectiontool.model.bean.PsGongcheng

internal class TongbuAdapter :
    BaseQuickAdapter<PsGongcheng?, BaseViewHolder>(
        R.layout.item_tongbu

    ) {


    override fun convert(helper: BaseViewHolder, item: PsGongcheng?) {
        helper.setText(R.id.name, item?.gcName)
        helper.setText(R.id.ssxm, item?.ssxmName)
        val status = if (item?.gcStatus == "1") {
            "完成"
        } else {
            "进行中"
        }
        helper.setText(R.id.status, status)
        try {
            helper.setText(R.id.gzl, item?.totalWork.toString())
        } catch (e: Exception) {
            e.printStackTrace()
        }
        var tbstatus:String?=null
        when(item?.tbStatus){
            0->{
               tbstatus="未同步"
            }
            1->{
                tbstatus="同步成功"
            }
            2->{
                tbstatus="同步失败"
            }

        }


        helper.setText(R.id.tbstatus,tbstatus)
        helper.setText(R.id.banzuz,item?.teamleader)
        helper.getView<CheckBox>(R.id.mcheck).isChecked= item?.ifchecked != 0

    }
}